<template>
	<view>
		<create-update :update="update" :stockId="stockId" @submit="handleSubmit"></create-update>
	</view>
</template>

<script>
	import createUpdate from './components/create-update.vue'
	
	export default {
		components: { createUpdate },
		data() {
			return {
				stockId: null,
				update: true
			}
		},
		onLoad(options) {
			this.stockId = options.stockId
			this.update = !!options.stockId
			
			// 注册一个通信接口
			this.eventChannel = this.getOpenerEventChannel()
			this.$wxSdkUtil.init(null, { hideShare: true })
		},
		methods: {
			// 监听提交事件 与上一个页面通信
			handleSubmit(postForm) {
				this.eventChannel.emit('submit', { postForm, msg: '修改了！！！' })
			},
		}
	}
</script>

<style lang="scss" scoped>
</style>